package com.dp.mallchat.common.user.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.dp.mallchat.common.user.dao.SensitiveWordDao;
import com.dp.mallchat.common.user.domain.entity.SensitiveWord;
import com.dp.mallchat.common.user.mapper.SensitiveWordMapper;
import com.dp.mallchat.common.user.sensitive.IWordFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.stream.Collectors;

/**
 * @Author: dupeng
 * @CreateTime: 2024-07-22  16:48
 * @Description: TODO
 */
@Service
@Slf4j
public class SensitiveWordServiceImpl implements IWordFactory {

    @Autowired
    private SensitiveWordDao sensitiveWordDao;

    @Override
    public List<String> getSensitiveWords() {
        return sensitiveWordDao.list()
                .stream()
                .map(SensitiveWord::getWord)
                .collect(Collectors.toList());
    }
}
